package com.jieshuibao.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jieshuibao.mapper.PolicyMapper;
import com.jieshuibao.model.db.Policy;
import com.jieshuibao.model.db.PolicyExample;

@Service
public class PolicyService{
	
	@Resource
	private PolicyMapper policyMapper;
	
	public void addPolicy(Policy policy) {
		policyMapper.insertSelective(policy);
	}
	
	public void delPolicyByUuid(String uuid) {
		policyMapper.deleteByPrimaryKey(uuid);
	}
	
	public void updatePolicy(Policy policy) {
		policyMapper.updateByPrimaryKeySelective(policy);
	}
	
	public Policy getPolicyByUuid(String uuid) {
		return policyMapper.selectByPrimaryKey(uuid);
	}
	
	public List<Policy> getPagePolicy(PolicyExample policyExample) {
		return policyMapper.selectPage(policyExample);
	}
	
	public int countPolicy(PolicyExample policyExample) {
		return policyMapper.countByExample(policyExample);
	}
}
